﻿using Base.Infrastructure.Dto.Request.Classes;
using Base.Service.Interface;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Base.Api.Admin.Controllers
{
    [Route("api/[controller]/[action]")]
    /*[ApiExplorerSettings(GroupName = "ClassManageMent")]*///分组
    [ApiController]
    public class ClassController : BaseController
    {
        private readonly IClassesService _classesService;

        public ClassController(Base.Service.Interface.IClassesService classesService)
        {
            _classesService = classesService;
        }

        /// <summary>
        /// 查询班级表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        //[Authorize]
        public IActionResult Queryclass(int page = 1, int limit = 10, string key = "20")
        {
            var result = _classesService.Queryclass(page, limit, key);
            return Ok(result);
        }

        /// <summary>
        /// 单个查询班级表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        //[Authorize]
        public IActionResult Singlequeryclass(string CID)
        {
            var result = _classesService.Singlequeryclass(CID);
            return Ok(result);
        }

        /// <summary>
        /// （添加班级）参数：CName/班级名称，CType/班级类型，CCount/班级人数，CIsFinish/是否毕业(0:未毕业/1：已毕业)，CIsActive/是否开班(0:未开班/1:已开班)
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult Addclass(CLassesRequestDto dto)
        {
            var result = _classesService.Addclass(dto);
            return Ok(result);
        }

        /// <summary>
        /// （修改班级）参数：CID/班级id，CName/班级名称，CType/班级类型，CCount/班级人数，CIsFinish/是否毕业(0:未毕业/1：已毕业)，CIsActive/是否开班(0:未开班/1:已开班)
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult Modifyclass(CLassesRequestDto dto)
        {
            var result = _classesService.Modifyclass(dto);
            return Ok(result);
        }
    }
}
